The Expere Document Engine makes use of caching to improve performance for document related tasks. The cache can be configured to either use the third party ehcache library, or to use a basic in-memory HashMap.
The default configuration is to use the ehcache library, and this is the best all around choice. Using the ehcache library allows for much greater configuration, such as the ability to overflow cache items to disk and expire items from the cache. The HashMap cache is not recommended because it will grow unchecked in size, and may exhaust the available memory quickly. The cache scheme is configured in the bsi.properties file. The property com.bankerssystems.framework.cache.CacheFactory defines the cache implementation class to use. The class com.bankerssystems.framework.cache.ehcache.EHCacheFactory encapsulates ehcache, and the class com.bankerssystems.framework.cache.MapCacheFactory is the basic HashMap implementation.
The Expere Document Engine caches three things:
- Partially processed Expere documents that are stored in the database
- The Resolution Catalog used by documents authored in the Expere Rule language
- Font metrics information
The basic HashMap cache has no configuration options and will simply grow unchecked in size. When using ehcache the cache configuration is defined in the ehcache.xml file in the Expere Document Engine EAR. The configuration of ehcache is documented at the ehcache project home at http://ehcache.sourceforge.net/. Notable features of ehcache are the ability to configure:
- The number of elements stored in memory before the cache overflows to disk
- The path where cache elements overflow to disk
- How elements in the cache are expired
- Whether or not the cache will persist between restarts of the application
The default configuration of the caches assumes there will be a modest amount of system memory available. The cache is configured by default to store ten documents in memory, and then overflow to disk. If additional memory is available performance may be improved by allowing more documents to reside in memory.
Additional Caching Information
- Caching behavior can be configured in the ehcache.xml file that lives at the root of the ExpereIEServices.EAR.
- The following caches should be defined for Expere to function properly:
- ContentCompiledObject - holds compiled content
- Font - caches fonts used when rendering static documents
- Fontconfigcache: holds the font configuration cache information
- Image - holds images used when rendering dynamic documents.
- The default configuration of ehcache uses the Java temp directory when overflowing objects to the disk store. Adjust amount of maxBytesLocalDisk based on the amount of disk space available. The value is defaulted to 50GB; however, if that amount of disk space is not available then you should reduce that setting.
- If the application is going to be deployed multiple times on the same hardware (even in separate application server instances) the disk store path must not be the same for more than one application instance or their cache files will collide. Set the diskStore path to the perferred Expere cache storage location.
- Exercise caution if changing any percentages. It is unlikely that you will gain anything by changing these percentages. The updated ehcache.xml file allocates memory by percentage rather than elements. It is no longer necessary to adjust.
- The Expere Document Engine application has a Cache Manager page that may be used to check the status of each of the caches. The Cache Manager displays two level counts for the ContentCompiledObject and Image caches:
- Level one is hash values.
- Level two contains the actual cache objects. The purpose of level two is to avoid caching the identical object more than once.
- Template fonts are also cached.